{include header}
<div class="wrapper">
    {include header_menu}

    {include left_menu}
    <div class="main-container">
        <div class="padding-md">
            <form method="get">
            <div class="search-input-wrapper">
                <div class="search-input">
                    <input type="hidden" name="gn" value="1" />
                    <input name="user" type="text" class="form-control input-sm inline-block" placeholder="用户名或者邮箱 关键字">
                    <a href="#" class="input-icon text-normal"><i class="ion-ios7-search-strong"></i></a>
                </div>
            </div>
            </form>
            <style>

            .table-striped>tbody>tr{
                    cursor: pointer;
            }
            </style>
            <script>
            (function(){

            });
            function edit_forum(obj){
                var i=0;
                $("#edit0").val('');
                $("#edit1").val('');
                $("#edit2").val('-1');
                $(obj).find('td').each(function(e){

                    $("#edit"+(i++)).val($(this).text());




                })
            }
            function deluser(id,obj){ //删除用户
                if(!confirm("确定删除?")){
                    return;
                }

                $(obj).attr("disabled",true);
                $.post(window.location.pathname,{id:id,gn:4},function(e){
                    $(obj).removeAttr("disabled");
                    if(e.error){
                        $(obj).parent().parent().remove();
                    }

                },'json');
            }
            </script>

            <table class="table table-striped table-bordered m-top-md" id="dataTable">
				<thead>
					<tr class="bg-dark-blue">
						<th>用户ID</th>
						<th>用户名称</th>
                        <th>用户组 ID</th>
						<th>Email</th>
                        <th>注册时间</th>
                        <th>操作</th>
					</tr>
				</thead>
				<tbody>
                    {foreach $data as $v}
                    <tr onclick="edit_forum(this)">
                        <td>{$v.id}</td>
                        <td>{$v.user}</td>
                        <td>{$v.group}</td>
                        <td>{$v.email}</td>
                        <td><?php echo empty($v['atime'])?'史前生物':date("Y-m-d H:i:s",$v['atime']) ?></td>
                        <td>
                            <button type="button" onclick="deluser({$v.id},this)" class="btn btn-danger btn-xs">删除</button>
                        </td>
                    </tr>
                    {/foreach}


				</tbody>
			</table>
            <div class="smart-widget-body">


				<a href="{if $pageid==1}javascript:void(0);{else}{#WWW}/admin/user.html?pageid={$pageid-1}{$fj}{/if}" class="btn btn-success marginTB-xs" {if $pageid==1}disabled{/if}><i class="fa fa-angle-double-left m-left-xs"></i> 上一页</a>

				<a href="{if $pageid==$page_count}javascript:void(0);{else}{#WWW}/admin/user.html?pageid={$pageid+1}{$fj}{/if}" style="float:right" class="btn btn-success marginTB-xs" {if $pageid==$page_count}disabled{/if}>下一页<i class="fa fa-angle-double-right m-left-xs"></i></a>


			</div>
            <div class="alert alert-danger alert-custom alert-dismissible" role="alert">
		    	<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
		     	<i class="fa fa-times-circle m-right-xs"></i> <strong>警告!</strong> 删除用户将会删除他所有数据,包括文章评论等,请慎重删除!
		    </div>
            <div class="row">
            <div class="col-md-6">
                <div class="smart-widget m-top-lg widget-dark-blue">
    				<div class="smart-widget-header">
    					添加用户
    					<span class="smart-widget-option">
    						<span class="refresh-icon-animated">
    							<i class="fa fa-circle-o-notch fa-spin"></i>
    						</span>

                            <a href="#" class="widget-collapse-option" data-toggle="collapse">
                                <i class="fa fa-chevron-up"></i>
                            </a>


                        </span>
    				</div>
    				<div class="smart-widget-inner">
    					<div class="smart-widget-body">
                            <h2>说明</h2>
                            <section>
    		                    <p></p>
    		                </section>
    						<form  method="post">
                                <input type="hidden" name="gn" value="2">

    							<div class="form-group">
    								<label for="">用户名</label>
    								<input type="text" name="user" class="form-control" >
    							</div>
                                <div class="form-group">
    								<label for="">邮箱</label>
    								<input type="email" name="email" class="form-control" >
    							</div>
                                <div class="form-group">
    								<label for="">密码</label>
    								<input type="text" name="pass" class="form-control" >
    							</div>


    							<button type="submit" class="btn btn-success btn-sm">提交</button>
    						</form>
    					</div>
    				</div><!-- ./smart-widget-inner -->
    			</div>
            </div>
            <div class="col-md-6">
                <div class="smart-widget m-top-lg widget-dark-blue">
    				<div class="smart-widget-header">
    					编辑用户
    					<span class="smart-widget-option">
    						<span class="refresh-icon-animated">
    							<i class="fa fa-circle-o-notch fa-spin"></i>
    						</span>

                            <a href="#" class="widget-collapse-option" data-toggle="collapse">
                                <i class="fa fa-chevron-up"></i>
                            </a>


                        </span>
    				</div>
    				<div class="smart-widget-inner">
    					<div class="smart-widget-body">
                            <h2>说明</h2>
                            <section>
    		                    <p></p>
    		                </section>
    						<form  method="post">
                                <input type="hidden" name="gn" value="3">
                                <input type="hidden" name="id" id="edit0">

    							<div class="form-group">
    								<label for="">用户名</label>
    								<input name="user" id="edit1" type="text" class="form-control" >
    							</div>
                                <div class="form-group">
    								<label for="">用户组 ID</label>
    								<input name="group" id="edit2" type="text" class="form-control" >
    							</div>
                                <div class="form-group">
    								<label for="">邮箱</label>
    								<input name="email" id="edit3" type="email" class="form-control" >
    							</div>
                                <div class="form-group">
    								<label for="">密码</label>
    								<input name="pass" id="" type="text" class="form-control">
    							</div><!-- /form-group -->

    							<button type="submit" class="btn btn-success btn-sm">提交</button>
    						</form>

    					</div>
    				</div><!-- ./smart-widget-inner -->
    			</div>
            </div>
            </div>
        </div><!-- ENd box  -->

    </div>
</div>
{include footer}
